package com.milhouz.findmydroid.bean;

import android.os.Parcel;
import android.os.Parcelable;

public class Team implements Parcelable {

	private int teamNumber;
	private int nbPoints = 0;

	public Team() {
	}

	public Team(final int teamNumber) {
		this.teamNumber = teamNumber;
		this.nbPoints = 0;
	}

	public int getTeamNumber() {
		return teamNumber;
	}

	public int getNbPoints() {
		return nbPoints;
	}

	public void addPoint() {
		nbPoints++;
	}

	public void removePoint() {
		if (nbPoints > 0) {
			nbPoints--;
		}
	}

	@Override
	public void writeToParcel(Parcel parcel, int flags) {
		parcel.writeInt(teamNumber);
		parcel.writeInt(nbPoints);
	}

	public static final Creator<Team> CREATOR = new Creator<Team>() {
		@Override
		public Team createFromParcel(Parcel source) {
			Team p = new Team();
			p.teamNumber = source.readInt();
			p.nbPoints = source.readInt();
			return p;
		}

		@Override
		public Team[] newArray(int arg0) {
			return null;
		}
	};

	@Override
	public int describeContents() {
		return 0;
	}

}
